# !/usr/bin/python3
# -*- coding: utf-8 -*-

"""
部门表模型类
----------------------------------------------------
@Project :   xinhou-openai-framework
@File    :   Dept.py
@Contact :   sp_hrz@qq.com

@Modify Time      @Author    @Version    @Desciption
------------      -------    --------    -----------
2023/04/16 22:04  peng.shen   v1.0.0     None
"""

from datetime import datetime
from typing import Optional

from pydantic import BaseModel, Field


class ReqDeptFindSchema(BaseModel):
    """
    部门表 查询入参参数&校验模型
    """

    id: Optional[int] = Field(
        default=None, title="部门id",
    )

    parent_id: Optional[int] = Field(
        default=None, title="父部门id",
    )

    dept_name: Optional[str] = Field(
        default=None, title="部门名称",
    )

    order_num: Optional[int] = Field(
        default=None, title="显示顺序"
    )

    leader: Optional[str] = Field(
        default=None, title="负责人",
    )

    phone: Optional[str] = Field(
        default=None, title="联系电话",
    )

    email: Optional[str] = Field(
        default=None, title="邮箱",
    )

    status: Optional[int] = Field(
        default=None, title="部门状态:1=正常,2=停用"
    )

    create_by: Optional[str] = Field(
        default=None, title="创建者",
    )

    created_at: Optional[datetime] = Field(
        default=None, title="创建时间",
    )

    update_by: Optional[str] = Field(
        default=None, title="更新者",
    )

    updated_at: Optional[datetime] = Field(
        default=None, title="更新时间",
    )

    remark: Optional[str] = Field(
        default=None, title="备注",
    )


class ReqDeptSaveSchema(BaseModel):
    """
    部门表 保存入参参数&校验模型
    """

    parent_id: Optional[int] = Field(
        title="父部门id", default='0',
    )

    dept_name: Optional[str] = Field(
        title="部门名称",
    )

    order_num: Optional[int] = Field(
        title="显示顺序", default='0',
    )

    leader: Optional[str] = Field(
        title="负责人",
    )

    phone: Optional[str] = Field(
        title="联系电话",
    )

    email: Optional[str] = Field(
        title="邮箱",
    )

    status: Optional[int] = Field(
        title="部门状态:1=正常,2=停用", default='0',
    )

    create_by: Optional[str] = Field(
        title="创建者",
    )

    created_at: Optional[datetime] = Field(
        title="创建时间",
    )

    update_by: Optional[str] = Field(
        title="更新者",
    )

    updated_at: Optional[datetime] = Field(
        title="更新时间",
    )

    remark: Optional[str] = Field(
        title="备注",
    )


class ReqDeptUpdateSchema(BaseModel):
    """
    部门表 更新入参参数&校验模型
    """

    id: int = Field(
        title="部门id",
    )

    parent_id: Optional[int] = Field(
        default=None, title="父部门id",
    )

    dept_name: Optional[str] = Field(
        default=None, title="部门名称",
    )

    order_num: Optional[int] = Field(
        default=None, title="显示顺序"
    )

    leader: Optional[str] = Field(
        default=None, title="负责人",
    )

    phone: Optional[str] = Field(
        default=None, title="联系电话",
    )

    email: Optional[str] = Field(
        default=None, title="邮箱",
    )

    status: Optional[int] = Field(
        default=None, title="部门状态:1=正常,2=停用"
    )

    create_by: Optional[str] = Field(
        default=None, title="创建者",
    )

    created_at: Optional[datetime] = Field(
        default=None, title="创建时间",
    )

    update_by: Optional[str] = Field(
        default=None, title="更新者",
    )

    updated_at: Optional[datetime] = Field(
        default=None, title="更新时间",
    )

    remark: Optional[str] = Field(
        default=None, title="备注",
    )


class ResDeptDetailSchema(BaseModel):
    """
    部门表 出参参数&校验模型
    """

    id: Optional[int] = Field(
        default=None, title="部门id",
    )

    parent_id: Optional[int] = Field(
        default=None, title="父部门id",
    )

    dept_name: Optional[str] = Field(
        default=None, title="部门名称",
    )

    order_num: Optional[int] = Field(
        default=None, title="显示顺序"
    )

    leader: Optional[str] = Field(
        default=None, title="负责人",
    )

    phone: Optional[str] = Field(
        default=None, title="联系电话",
    )

    email: Optional[str] = Field(
        default=None, title="邮箱",
    )

    status: Optional[int] = Field(
        default=None, title="部门状态:1=正常,2=停用"
    )

    create_by: Optional[str] = Field(
        default=None, title="创建者",
    )

    created_at: Optional[datetime] = Field(
        default=None, title="创建时间",
    )

    update_by: Optional[str] = Field(
        default=None, title="更新者",
    )

    updated_at: Optional[datetime] = Field(
        default=None, title="更新时间",
    )

    remark: Optional[str] = Field(
        default=None, title="备注",
    )
